package cn.yuxiaoyuan.service.impl;

import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.IdUtil;
import cn.yuxiaoyuan.pojo.domain.CustomerCar;
import cn.yuxiaoyuan.mapper.CustomerCarMapper;
import cn.yuxiaoyuan.service.ICustomerCarService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 * 客户车辆 服务实现类
 * </p>
 *
 * @author whale
 * @since 2025-06-27
 */
@Service
public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, CustomerCar> implements ICustomerCarService {

    @Override
    public boolean save(CustomerCar entity) {
        entity.setId(IdUtil.createSnowflake(1L,1L).nextId());
        entity.setCustomerId(StpUtil.getLoginIdAsLong());
        entity.setCreateTime(new Date());
        return super.save(entity);
    }
}
